<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>职位</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="Hosting Store Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>

    <%--<link href="${pageContext.request.contextPath}/static/admin/assets/css/minimal.css" rel="stylesheet"/>--%>
    <link href="${pageContext.request.contextPath}/static/home/css/bootstrap.css" rel='stylesheet' type='text/css' />

    <script src="${pageContext.request.contextPath}/static/home/js/jquery-1.11.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/admin/assets/js/vendor/bootstrap/bootstrap.min.js"></script>
    <!-- Custom Theme files -->
    <link href="${pageContext.request.contextPath}/static/home/css/style.css" rel='stylesheet' type='text/css' />
    <!-- Custom Theme files -->

    <!-- webfonts -->
    <link href='${pageContext.request.contextPath}/static/home/css/font-awesome.css' rel='stylesheet' type='text/css'/>
    <!-- webfonts -->
    <!-- dropdown -->
    <script src="${pageContext.request.contextPath}/static/home/js/jquery.easydropdown.js"></script>

    <link href="${pageContext.request.contextPath}/static/home/css/nav.css" rel="stylesheet" type="text/css" media="all"/>
    <link href="${pageContext.request.contextPath}/static/admin/css/sweetalert.css" rel="stylesheet">

    <link href="${pageContext.request.contextPath}/static/home/css/resume_manage.css" rel='stylesheet' type='text/css' />
    <!-- start-smoth-scrolling -->
    <script src="${pageContext.request.contextPath}/static/admin/js/sweetalert.min.js"></script>
    <!-- start-smoth-scrolling -->
    <!-- webfonts -->
    <%--<link href='http://fonts.useso.com/css?family=Ubuntu:300,400,500,700' rel='stylesheet' type='text/css'>--%>
    <!-- webfonts -->
    <!-- start-smoth-scrolling -->
    <link href="${pageContext.request.contextPath}/static/admin/assets/css/vendor/bootstrap/bootstrap.min.css" rel="stylesheet"/>

    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/home/css/bootstrap-checkbox.css">
    <link href="${pageContext.request.contextPath}/static/home/css/job_management_table.css" rel="stylesheet">
    <style>

    </style>
</head>
<!-- Header Starts Here -->
<div class="banner inner-banner" >
    <%@include file="../header.jsp"%>

    <div id="breadcrumb_wrapper">
        <div class="container">

            <h3><strong>简历结果</strong></h3>
            <h6>&nbsp;</h6>

            <div class="clearfix"></div>
        </div>
    </div>
</div>
<div class="clearfix"> </div>
<!-- Header Ends Here -->

<!--Main Starts Here-->
<div class="container">
    <div class="tab-content" id="home">
        <div class="tile-body color transparent-black rounded-corners tab-pane fade in active ">
            <div class="table-responsive">
                <table class="table table-datatable table-custom basicDataTable">
                    <thead>
                    <tr>
                        <th class="no-sort">姓名</th>
                        <th class="sort-amount">应聘职位</th>
                        <th class="sort-amount">籍贯</th>
                        <th class="sort-numeric">期望薪资</th>
                        <th class="sort-numeric">学历</th>
                        <th class="no-sort">工作领域</th>
                        <th class="no-sort">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:if test="${searchResumePage.resumeId!=null}">
                        <td>${resume.realname}</td>
                        <td>${resume.expect_job}</td>
                        <td>${resume.origin_city.zone.name} ${resume.origin_city.name}</td>
                        <td>${resume.salary_type.value}</td>
                        <td>${resume.degree.degree_name}</td>
                        <td>${resume.industry.industry_name}</td>
                        <td class="actions">
                            <a href="#" class="send" data-toggle="modal" id="${resume.resume_id}" onclick="sendPage(${resume.resume_id})">邀请面试 </a>
                            <a href="#" class="detail">详情 </a>
                        </td>
                    </c:if>
                    </tbody>
                </table>
            </div>
        </div>

        <div class="tile-footer bg-transparent-black-2 rounded-bottom-corners">
            <div class="row">

                <%--<div class="col-sm-4">--%>
                <%--<button type="button" class="btn btn-default btn-xs margin-bottom-20" onclick="delete_confirm()">删除</button>--%>
                <%--</div>--%>

                <div class="col-sm-offset-4 col-sm-4 text-center">
                    <small class="inline table-options paging-info"></small>
                </div>

                <div class="col-sm-4 text-right sm-center">
                    <ul class="pagination pagination-xs nomargin pagination-custom">

                    </ul>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:80%;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">选取一份简历</h4>
                </div>
                <div class="modal-body">
                    <div class="tab-content">
                        <div class="tile-body color transparent-black rounded-corners tab-pane fade in active ">
                            <div class="table-responsive">
                                <table  class="table table-datatable table-custom basicDataTable">
                                    <thead>
                                    <tr>
                                        <th class="no-sort">标签</th>
                                        <th class="sort-amount">职位名称</th>
                                        <th class="sort-amount">职位类型</th>
                                        <th class="sort-numeric">薪资范围</th>
                                        <th class="sort-numeric">学历要求</th>
                                        <th class="sort-numeric">工作年限</th>
                                    </tr>
                                    </thead>
                                    <tbody>

                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <div class="tile-footer bg-transparent-black-2 rounded-bottom-corners">
                            <div class="row">

                                <div class="col-sm-offset-4 col-sm-4 text-center">
                                    <small class="inline table-options paging-info"></small>
                                </div>

                                <div class="col-sm-4 text-right sm-center">
                                    <ul class="pagination pagination-xs nomargin pagination-custom">

                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button id="confirm" onclick="sendJob()" type="button" class="btn btn-primary" style="background:#1BBC9B; border:none;">确定</button>
                </div>
            </div><!-- /.modal-content -->
        </div>
    </div>
    <input type="hidden" value="" id="resume_id">
</div>



<table id="table_td_temp2" style="display:none">
    <tbody id="template-list-tbody2">
    <tr class="odd gradeA">
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td class="actions">
            <a href="#myModal" class="send" data-toggle="modal" id="" onclick="sendPage()">邀请面试 </a>
            <a href="#" class="detailForCompany">详情 </a>
        </td>
    </tr>
    </tbody>
</table>

<table id="table_td_temp" style="display:none">
    <tbody id="template-list-tbody">
    <tr class="even gradeC">
        <td><input value="" type="radio" name="resume"/></td>
        <td>Number</td>
        <td>Job</td>
        <td>Salary</td>
        <td>Place</td>
        <td>Time</td>
    </tr>
    </tbody>
</table>
<!-- #Footer -->
<%@include file="../footer.jsp"%>
<!-- /#Footer -->
<!-- here stars scrolling icon -->
<script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/move-top.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/easing.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/moment.min.js"></script>
<script src="${pageContext.request.contextPath}/static/admin/js/page.js"></script>
<script src="${pageContext.request.contextPath}/static/home/js/page.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/daterangepicker-1.3.7.js"></script>
<script type="text/javascript">
    jQuery(document).ready(function($) {
        $(".scroll").click(function(event){
            event.preventDefault();
            $('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
        });
    });
</script>
<!-- /#Footer -->
<!-- here stars scrolling icon -->
<script type="text/javascript">
    $(document).ready(function() {
        /*
         var defaults = {
         containerID: 'toTop', // fading element id
         containerHoverID: 'toTopHover', // fading element hover id
         scrollSpeed: 1200,
         easingType: 'linear'
         };
         */

        $().UItoTop({ easingType: 'easeOutQuart' });

    });
</script>

<!-- //here ends scrolling icon -->



<script>


</script>

<script>

    var fetchData = function (furl) {
        var show = "";
        if(furl==null) {
            url = "${pageContext.request.contextPath}/home/resume/getJobList.action?p=1";
        }else{
            url = furl;
        }
        $.ajax({
            type:'get',
            url:url,
            success:function(json){
                console.log(json);
                show = json.show;
                if (show=="" ||show.totalRows == 0) {
                    $("#myModal table tbody").html('<tr><td colspan="10" align="center">暂无记录</td></tr>');
                    $('#myModal .paging-info').html("showing 0-0 of 0 items");
                    $('#myModal .pagination').html("");
                    return;
                } else {
                    var list = json.data;
                    var body = $("#myModal table tbody");
                    var temp_body = $('#template-list-tbody');
                    var tds = $('#table_td_temp td');
                    var string = "";
                    for (var i in list) {
                        $("#table_td_temp input").val(list[i].job_id);
                        tds[1].innerHTML = list[i].job_name;
                        tds[2].innerHTML = list[i].jobType.job_type_name;
                        tds[3].innerHTML = list[i].salaryType.value;
                        tds[4].innerHTML = list[i].degree.degree_name;
                        tds[5].innerHTML = list[i].work_year;
                        string += temp_body.html();
                    }
                    body.html(string);
                    if(show.currentPage == show.totalPage){
                        $('#myModal .paging-info').html("showing "+(show.startIndex+1)+"-"+show.totalRows+" of "+show.totalRows+" items");
                    }else {
                        $('#myModal .paging-info').html("showing "+(show.startIndex+1)+"-"+show.endIndex+" of "+show.totalRows+" items");
                    }
                    make_page(show, '#myModal .pagination','?');
                }
            }
        });
    };
    fetchData();

    var fetchData2 = function (furl) {
        var show = "";
        if(furl==null) {
            url2 = "${pageContext.request.contextPath}/home/resume/getSearchList.action?p=1";
        }else{
            url2 = furl;
        }
        $.ajax({
            type:'get',
            url:url2,
            dataType:'json',
            data:{
                jobName:'${searchResumePage.jobName}',
                work_year:'${searchResumePage.work_year}',
                degree_id:'${searchResumePage.degree_id}',
                salary_type_id:'${searchResumePage.salary_type_id}',
                sex: '${searchResumePage.sex}',
                industry_id:'${searchResumePage.industry_id}',
                resumeId:'${searchResumePage.resumeId}'
            },
            success:function(json){
                console.log(json);
                show = json.show;
                if (show=="" ||show.totalRows == 0) {
                    $("#home table tbody").html('<tr><td colspan="10" align="center">暂无记录</td></tr>');
                    $('#home .paging-info').html("showing 0-0 of 0 items");
                    $('#home .pagination').html("");
                    return;
                } else {
                    var list = json.data;
                    var body = $("#home table tbody");
                    var temp_body = $('#template-list-tbody2');
                    var tds = $('#table_td_temp2 td');
                    var string = "";
                    for (var i in list) {
                        $("#table_td_temp2 .send").attr("id",list[i].resume_id);
                        $("#table_td_temp2 .send").attr("onclick","sendPage("+list[i].resume_id+")");
                        $('#table_td_temp2 .detailForCompany').attr("href","${pageContext.request.contextPath}/home/resume/detailForCompany.action?resume_id="+list[i].resume_id);
                        tds[0].innerHTML = list[i].realname;
                        tds[1].innerHTML = list[i].expect_job;
                        tds[2].innerHTML = list[i].origin_city.zone.name + list[i].origin_city.name;
                        tds[3].innerHTML = list[i].salary_type.value;
                        tds[4].innerHTML = list[i].degree.degree_name;
                        tds[5].innerHTML = list[i].industry.industry_name;
                        string += temp_body.html();
                    }
                    body.html(string);
                    if(show.currentPage == show.totalPage){
                        $('#home .paging-info').html("showing "+(show.startIndex+1)+"-"+show.totalRows+" of "+show.totalRows+" items");
                    }else {
                        $('#home .paging-info').html("showing "+(show.startIndex+1)+"-"+show.endIndex+" of "+show.totalRows+" items");
                    }
                    make_page2(show, '#home .pagination','?');
                }
            }
        });
    };
    if (${searchResumePage.resumeId==null}) {
        fetchData2();
    }

</script>
<script>



    function sendJob() {
        var job_id = $('input:radio[name=resume]:checked').val();
        console.log(job_id);
        var resume_id = $('#resume_id').val();
        console.log(resume_id);
        $.ajax({
            type:'post',
            url:'${pageContext.request.contextPath}/home/resume/sendJob.action',
            data:'resume_id='+resume_id+'&job_id='+job_id,
            success:function(data) {

                if(data == 1){
                    console.log(data);
                    swal("","邀请成功！","success");
                }else if(data == -1){
                    swal("","简历已邀请,无须重复邀请","warning");
                }else {
                    swal("","服务器出错！","error");
                }
            }
        });
    }

    function sendPage(resume_id) {
        //var resume_id = $('.send').attr('id');
        console.log(resume_id);
        $('#resume_id').val(resume_id);
    }
</script>
</body>
</html>
